#include "ExampleClassTest.h"

namespace Demo {
	std::vector<std::string> ExampleClassTest::functionNames;

	void ExampleClassTest::testConstructor() {
		ExampleClass<int> egClassInt(TEST_VALUE_INT);
		int exampleClassStoredValue = egClassInt.getValue();
		CPPUNIT_ASSERT_EQUAL(TEST_VALUE_INT, exampleClassStoredValue);

		ExampleClass<double> egClassDouble(TEST_VALUE_DOUBLE);
		double exampleClassStoredValue2 = egClassDouble.getValue();
		CPPUNIT_ASSERT_EQUAL(TEST_VALUE_DOUBLE, exampleClassStoredValue2);
	}

	void ExampleClassTest::testGetter() {
		ExampleClass<int> egClassInt(TEST_VALUE_INT);
		int exampleClassStoredValueInt = egClassInt.getValue();
		CPPUNIT_ASSERT_EQUAL(TEST_VALUE_INT, exampleClassStoredValueInt);

		ExampleClass<double> egClassDouble(TEST_VALUE_DOUBLE);
		double exampleClassStoredValueDouble = egClassDouble.getValue();
		CPPUNIT_ASSERT_EQUAL(TEST_VALUE_DOUBLE, exampleClassStoredValueDouble);
	}

	void ExampleClassTest::testSetter() {
		ExampleClass<int> egClassInt(0);
		//egClassInt.setValue(TEST_VALUE_INT);
		int exampleClassStoredValueInt = egClassInt.getValue();
		CPPUNIT_ASSERT_EQUAL(TEST_VALUE_INT, exampleClassStoredValueInt);

		ExampleClass<double> egClassDouble(0.0);
		egClassDouble.setValue(TEST_VALUE_DOUBLE);
		double exampleClassStoredValueDouble = egClassDouble.getValue();
		CPPUNIT_ASSERT_EQUAL(TEST_VALUE_DOUBLE, exampleClassStoredValueDouble);
	}

	CppUnit::Test *ExampleClassTest::suite() {
		/// initialize functionNames
		functionNames.push_back("testConstructor");
		functionNames.push_back("testGetter");
		functionNames.push_back("testSetter");
		CppUnit::TestSuite *testSuite = new CppUnit::TestSuite("ExampleClassTest");

		/// add test cases
		testSuite->addTest(new CppUnit::TestCaller<ExampleClassTest>("testConstructor", &Demo::ExampleClassTest::testConstructor));
		testSuite->addTest(new CppUnit::TestCaller<ExampleClassTest>("testGetter", &Demo::ExampleClassTest::testGetter));
		testSuite->addTest(new CppUnit::TestCaller<ExampleClassTest>("testSetter", &Demo::ExampleClassTest::testSetter));

		/// return
		return testSuite;
	}
}